﻿using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Core.Report.PlugIn;
using Kingdee.BOS.Core.Report.PlugIn.Args;
using Kingdee.BOS.Util;
using System.ComponentModel;

namespace Caraya.MFG.BusinessPlugIn
{
    /// <summary>
    /// 表单插件
    /// </summary>
    [Description("二开简单账表-采购物料计算汇总"), HotUpdate]
    public class PurTotalEdit : AbstractSysReportPlugIn
    {
        public override void CellDbClick(CellEventArgs Args)
        {
            base.CellDbClick(Args);
            var view = this.View as ISysReportView;
            if (view == null)
            {
                return;
            }
            if (view.SelectedDataRows != null && view.SelectedDataRows.Length > 0)
            {
                var billNo = view.SelectedDataRows[0][1].ToString();
                var fNumber = view.SelectedDataRows[0][2].ToString();
                var showParameter = new Kingdee.BOS.Core.Report.SysReportShowParameter();// SQLReportShowParameter();
                showParameter.FormId = "k96cbdafd238f49d2942274b47be8c7e3";
                showParameter.IsShowFilter = false;
                showParameter.ParentPageId = view.PageId;
                //showParameter.CustomParams.Add("Id","0");
                //showParameter.CustomParams.Add("chkscheme", "false");
                showParameter.CustomParams.Add("FMATERIALID_Id", billNo);
                showParameter.CustomParams.Add("FMATERIALID", fNumber);
                this.View.ShowForm(showParameter);
            }
        }


        //public override void EntityRowDoubleClick(EntityRowClickEventArgs e)
        //{
        //    //base.EntityRowDoubleClick(e);
        //    var view = this.View as ISysReportView;
        //    if (view == null)
        //    {
        //        return;
        //    }
        //    // 双击数据行时，打开新账表

        //    if (view.SelectedDataRows != null && view.SelectedDataRows.Length > 0)
        //    {
        //        var billNo = view.SelectedDataRows[0]["单据编号"].ToString();
        //        var showParameter = new Kingdee.BOS.Core.Report.SysReportShowParameter();// SQLReportShowParameter();
        //        showParameter.FormId = "k10b1919206334052afef29d7b91cd318";
        //        showParameter.CustomParams["CustomFilterRow"] = "#FBillNo#,单据编号," + billNo;
        //        this.View.ShowForm(showParameter);
        //    }
        //}
    }
}
